﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using RentAWorker.Business.Interfaces;
using RentAWorker.Business.DTO;
using RentAWorker.Desktop.Entities;

namespace Services
{
    public class DummyRentRequestService : IRentRequestService
    {
        public SearchResourceResponse SearchAvailableResources(SearchResourceRequest request)
        {
            return new SearchResourceResponse();
        }

        public RentalServiceResponse RequestRentalService(RentalServiceRequest request)
        {
            return new RentalServiceResponse();
        }

        public RentalServiceResponse GetRentalServiceForCustomer(RentalServiceForCustomerRequest request)
        {
            return new RentalServiceResponse()
            {
                Succeeded = true,
                Services = new List<RentalService>()
                {
                    new RentalService()
                    {
                        Customer = new Customer()
                        { 
                            CustomerID= request.CustomerId,
                            Name = String.Format("Customer {0}", request.CustomerId)
                        },
                        StartDate = DateTime.Now,
                        EndDate = DateTime.Now.AddDays(2),
                        RentalServiceState = new RentalServiceState()
                        {
                            RentalServiceStateName = "Accepted"
                        },
                        Resource = new Worker()
                        {
                            Name = "Max der Baumeister",
                            Location = new Location()
                            {
                                LocationName = "Wien"
                            }
                        }
                    }
                }.ToArray()
            };
        }

        public RentalServiceResponse GetRentalServicesForCustomer(RentalServicesForCustomerRequest request)
        {
            return new RentalServiceResponse()
            {
                Succeeded = true,
                Services = new List<RentalService>()
                {
                    new RentalService()
                    {
                        Customer = new Customer()
                        { 
                            CustomerID= request.CustomerId,
                            Name = String.Format("Customer {0}", request.CustomerId)
                        },
                        StartDate = DateTime.Now,
                        EndDate = DateTime.Now.AddDays(2),
                        RentalServiceState = new RentalServiceState()
                        {
                            RentalServiceStateName = "Accepted"
                        },
                        Resource = new Worker()
                        {
                            SSNo = "54321",
                            Name = "Max der Baumeister",
                            Location = new Location()
                            {
                                LocationName = "Wien"
                            }
                        }
                    },
                    new RentalService()
                    {
                        Customer = new Customer()
                        { 
                            CustomerID= request.CustomerId,
                            Name = String.Format("Customer {0}", request.CustomerId)
                        },
                        StartDate = DateTime.Now,
                        EndDate = DateTime.Now.AddDays(2),
                        RentalServiceState = new RentalServiceState()
                        {
                            RentalServiceStateName = "Accepted"
                        },
                        Resource = new Machine()
                        {
                            SerialNo = "12345",
                            Name = "Das Tolle Werkzeug",
                            Location = new Location()
                            {
                                LocationName = "Wien"
                            }
                        }
                    }
                }.ToArray()
            };
        }

        public RentalServiceResponse ChangeRentalServiceForCustomer(RentalServiceChangeRequest request)
        {
            return new RentalServiceResponse()
            {
                Succeeded = true
            };
        }
    }
}
